<?php 
		$user=$session->read('User');
		$colleageid=$session->read("colleageid");
?>
<div class="right_side_operate_area">

	<div class="right_side_title left">
		<h2>
			<?php 
					$colleagename=$session->read("colleagename");
					echo $html->link($colleagename,"/colleages/showcolleageinfo/".$colleageid);
			?>
		</h2>
		<div class="clear"></div>
	</div>
	
    <div class="right item_add_btn">
    <?php 
    	if($form->value('CgPerson.id'))
    	{
    		$str_title=__("Edit",true);
		}
		else
		{
			$str_title=__("Add",true);
		}
		echo $html->link(__("Cancel",true).$str_title,"/colleages/person/");
    ?>
    </div>
    <div class="clear"></div>
    
</div>


<div class="right_side_scollbar">
    <div class="detail_info_panel">
    
    	<?php echo $form -> create('colleages', array('action' => 'editperson','type'=> 'post','onsubmit'=>'return  checkedinfo()') ); ?>
    	
    	<?php 
        	$radiovalue=array("1"=>"是","0"=>"否");
         	$attributes=array('legend'=>false);
        ?>
        
	    	<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">姓名：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPerson.name');?></div>
				       <div id='namemessage' style='display:none;' class="error_message">请填写姓名</div>
			      </div>
			</div>
			
			<div class="details_item_line"> 
	            <div class="details_item">
	                <div class="form_left_title left">职称：</div>
	                <div class="form_right_input left"><?php echo $form->select('CgPerson.title',$colleage_title, null)?></div>
	                <div id='titlemessage' class="error_message"></div>
	            </div>
        	</div>
			
			<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">联系地址：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPerson.address');?></div>
			      </div>
		    </div>
		   
			<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">联系电话：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPerson.tel');?></div>
				       <div id='telmessage' style='display:none;' class="error_message">请填写联系电话</div>
			      </div>
		    </div>
			      
			<div class="details_item_line">
			        <div class="details_item">
				      <div class="form_left_title left">联系邮箱：</div>
				      <div class="form_right_e_input left"><?php echo $form->text('CgPerson.email',array("maxlength"=>"50","style"=>"ime-mode:disabled"));?></div>
				      <?php echo $form->text('User.uemail',array("class"=>"txthide","value"=>$form->value('CgPerson.email')));?>
				      <div id='colleageemailmessage' style='display:none;' class="error_message">邮箱格式不正确</div>
			      </div>
			</div>
			
			<!--  
			<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">高校联系人：</div>
				      <div class="form_right_input left"><?php echo $form->radio('CgPerson.is_contact',$radiovalue,$attributes);?></div>
			      </div>
			</div>
			 -->
			   
			<div class="details_item_line">
			      <div class="details_item">
				      <div class="form_left_title left">负责方向：</div>
				      <div class="form_right_e_input left"><?php echo $form->textarea('CgPerson.direction',array('class' => 'form_textarea','wrap'=>'virtual'));?></div>
				      <div id='directionmessage' style='display:none;' class="error_message">请填写负责方向</div>
			      </div>
			</div>
			
			
			<div class="details_item_line">
				<div class="details_item">
						<div class="form_left_title left"></div>
				        <div class="form_add_submit left">
				        	<?php echo $form->submit(__('Save',true), array("id"=>"addactive","name"=>"submit","class"=>"buttom","div"=>false));  ?>
				            <?php echo $form->hidden('CgPerson.colleage_id',array("value"=>$colleageid)) ;?>
				        	<?php echo $form->hidden('CgPerson.id') ?>
				        </div>
				</div>
		 </div>
    
    </div>
</div>


<script>
$("#CgPersonTitle option:first").html('请选择类型');

<!--检验Email的格式是否正确-->
$("#CgPersonEmail").blur(function() {  
    var mail=this.value;
    var umail=$("#UserUemail").val();
 	checkuserbymail(webpath,mail,umail,"#colleageemailmessage");
});  	

function checkedinfo()
{
		var mail=$("#CompanyEmail").val();
		 if($("#CgPersonName").val().trim() == '')
		 {
				$("#namemessage").css('display','block');
				return false;
		  }
		  else
		  {
			 	 $("#namemessage").css('display','none');
		  }

		 if($("#CgPersonTitle").val().trim() == '')
		 {
				$("#titlemessage").html('请选择职称');
				return false;
		 }
		 else
		 {
			 	 $("#titlemessage").html('');
		 }
			 	  
		   if($("#CgPersonTel").val().trim() == '')
		   {
				$("#telmessage").css('display','block');
				return false;
		  }
		  else
		  {
			 	 $("#telmessage").css('display','none');
		   }

		   if($("#CgPersonDirection").val().trim() == '')
		   {
			   $("#directionmessage").css('display','block');
				return false;
		   }
		   else
		   {
			   $("#directionmessage").css('display','none');
		   }
		   
		  if($("#colleageemailmessage").css('display')=="block")
		  {
		 		return false;
		  }
}
</script>